<#--
	f:field
	m:message text
-->
<#macro info f=false m=false class="" func_all=Client.getMessages func=Client.getMessage typ="info">
<#if m?is_boolean && f?is_string><#assign t=S(func(f))/><#else><#assign t=m/></#if>
<#if t?is_string><#if t?trim != ''>
<span class="${typ} ${class}">${t?html}</span><#nested>
</#if><#else><#assign ms=func_all()/><#if ms?size gt 0>
<span class="${typ} ${class}">
<#list ms as s>${s?html}<br></#list>
</span><#nested>
</#if></#if></#macro>

<#--
	f:field
	m:message text
-->
<#macro warn f=false m=false class="">
<@info f=f m=m class=class func_all=Client.getErrors func=Client.getError typ="warn"/>
</#macro>

<#--
	TODO
 -->
<#macro TODO>
<div style="width:100%;height:100%;background:red;font-size:30px;color:yellow">
哥们,记得还没实现哟~<#nested>
</div>
</#macro>

<#--
	a:action
-->
<#macro form action=false id=false target=false onsubmit=false upload=false class="">
<form <#if action?is_string>action="${URL(action)}"</#if> method="POST" class="form ${class}"
<#if id?is_string> id=${id} </#if><#if target?is_string> target="${target}" </#if>
<#if onsubmit?is_string> onsubmit="${onsubmit}" </#if>
<#if upload> enctype="multipart/form-data" </#if> >
<#nested>
</form>
</#macro>

<#--hidden-->
<#macro hidden f v=form>
	<input type="hidden" name="${f}" value=<#if v?is_macro>${Q($ROOT$[f])}<#else>${Q(v)}</#if>>
</#macro>

<#-- input -->
<#macro input f v=form pwd=false editable=true>
	<input type="<#if pwd>password<#else>text</#if>" name="${f}" class="input" 
		value=<#if v?is_macro>${Q($ROOT$[f])}<#else>${Q(v)}</#if>>
</#macro>

<#-- checkbox -->
<#macro checkbox f v=true editable=true>
	<input type="checkbox" name="${f}" class="checkbox" value=${Q(v)} <#if $ROOT$[f]==v>checked</#if>>
	<#nested>
</#macro>

<#-- radio -->
<#macro radio f v editable=true>
	<input type="radio" name="${f}" value=${Q(v)} <#if $ROOT$[f]==v>checked</#if>>
	<#nested>
</#macro>

<#-- option -->
<#macro option f v editable=true>
	<option value=${Q(v)} <#if $ROOT$[f]==v>selected</#if>><#nested></option>
</#macro>

<#-- button -->
<#macro button goto=false onclick=false action=false>
	<input <#if action?is_string ||(goto?is_boolean && onclick?is_boolean)>type="submit"
		<#else>type="button"</#if> class="button" value="<#nested>" 
		onclick="<#if onclick?is_string>${onclick};</#if>
				<#if goto?is_string>$goto('${goto}')<#elseif action?is_string>$submit('${action}')</#if>">
</#macro>

<#--
	pane
-->
<#macro pane title url=false id="" class="">
<div id="${id}" class="pane ${class}">
<div class="title">
<#if url?is_boolean>
	<span >${title?html!"&nbsp;"}</span>
<#else>
	<a href="${url}" class="link">
	 ${title?html!"&nbsp;"}
	</a>
</#if>
</div>
<div class="content">
<#nested>
</div></div>
</#macro>

<#--
	panes
-->
<#macro panes id=false class="">
<#assign _IN_PANES_=true>
<div class="panes ${class}" id="${id}">
<#nested>
</div>
<#assign _IN_PANES_=false>
</#macro>


